<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- 引入easyui 的主题样式  和  easyui 提供的图标样式 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/icon.css" />
<!-- 引入jquery 和  easyui.js   中文设置js-->
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">
$(function(){
	$('#dg').datagrid({    
		url:'Cargostatu',
		fitColumns:true,
	    columns:[[  
	        {field:'ck',width:100,checkbox:true},
	        {field:'csId',title:'csId',width:100,hidden:true},    
	        {field:'package',title:'封装袋号 ',width:100,align:'center'}, 
	        {field:'orId',title:'订单号',width:100,hidden:true},
	        {field:'csCurrentLocation',title:'当前地点',width:100,align:'center'},
	        {field:'csNextLocation',title:'下一目地点',width:100,align:'center'},
	        {field:'csCurrentDate',title:'当前时间',width:100,align:'center'},
	        {field:'driverId',title:'司机id',width:100,hidden:true},     
	    ]]
	})

		//更新货物状态信息
		$("#mm1").hide();
		$('#btn').linkbutton({
			iconCls : 'icon-cut',
			onClick : function() {
				$("#mm1").show();
				var stu = $('#dg').datagrid('getSelections');
				
				$("#tb1").val(stu[0].csCurrentLocation);
				$("#tb2").val(stu[0].csNextLocation);
				
			
			}
		});
		//确定修改
		$('#btn2').linkbutton({
			iconCls : 'icon-ok',
			onClick : function() {
				
				var csCurrentLocation = $("#tb1").val();
				var csNextLocation = $("#tb2").val();
  alert(csCurrentLocation)
				$.ajax({
					type : "post",
					url : "UpdateCargostatu",
					data : {
					
						'csCurrentLocation' : csCurrentLocation,
						'csNextLocation' : csNextLocation,
					
					},
					dataType : "text",
					success : function(data) {
						if (data == 1) {
							$('#dg').datagrid('reload');
							$.messager.alert('警告', '更新成功');
						} else {
							$.messager.alert('警告', '更新失败！');
						}
					}
				})
				$("#mm1").hide();
			}

		})

});

</script>
<body>
<table id="dg"></table>
<a id="btn" href="#">更新信息</a>
<a id="btn2" href="#">更新确定</a>
<!-- 更新货物信息 -->
	<div id="mm1">
		<form>			
			<span>当前地点</span><input id="tb1" type="text" style="width: 100px">
			<span>下一目地点</span><input id="tb2" type="text" style="width: 100px">
			
		</form>
	</div>

</body>
</html>